﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;

using System.Text;
using System.Windows.Forms;
using DAO;
using DTO;
using BUS;

namespace ProductManagement
{
    public partial class frmBinhGas : Form
    {
        public frmBinhGas()
        {
            InitializeComponent();
        }

        private void frmBinhGas_Load(object sender, EventArgs e)
        {
            try
            {
                String strSql = "select loai.TenLoai as LoaiGas, gas.ID as ID, gas.SoLuong as SoLuong from BinhGas gas, LoaiGas loai where gas.LoaiGas=loai.ID";
                DataTable dt = DataAccess.Query(strSql);
                dt.Columns.Add(new DataColumn("STT", typeof(int)));
                dgvBinhGas.AutoGenerateColumns = false;
                dgvBinhGas.DataSource = dt;
                for (int i = 0; i < dgvBinhGas.Rows.Count; i++)
                    dgvBinhGas.Rows[i].Cells["STT"].Value = i + 1;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Không thể load form\r\n" + ex.Message, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                Close();
            }
        }

        private void btnBack_Click(object sender, EventArgs e)
        {
            Close();
        }
    }
}
